package api

import (
	"fmt"
	"github.com/eko/gocache/lib/v4/cache"
)

type Option func(*ApiCli)

func WithConfig(config *MpConfig) Option {
	return func(c *ApiCli) {
		if _, ok := m[config.Provider]; !ok {
			panic(fmt.Errorf("unsupport provider :%s", config.Provider))
		}
		c.config = config
	}
}

func WithCacheManager(cacheManager *cache.Cache[*AccessToken]) Option {
	return func(ac *ApiCli) {
		ac.cacheManager = cacheManager
	}
}
